﻿using LF.Common;
using LF.Domain.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LF.Domain.Services
{
    public interface IAppManagerService : IDomainService
    {
        /// <summary>
        /// 初始化系统管理员账号和所有权限
        /// </summary>
        /// <returns>成功创建返回true，已存在返回false</returns>
        bool InitializeSysAdmin();
        
        /// <summary>
        /// 获取所有字典
        /// </summary>
        /// <returns></returns>
        AppDic[] GetAppDic();
        /// <summary>
        /// 获得字典项
        /// </summary>
        /// <param name="group"></param>
        /// <returns></returns>
        AppDic[] GetAppDic(string group);
        /// <summary>
        /// 获得所有字典，分页显示
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        List<AppDic> GetAppDic(int index, int size);
        /// <summary>
        /// 获得所有字典，分页显示
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <param name="key">关键字</param>
        /// <returns></returns>
        List<AppDic> GetAppDic(int index, int size,string key);

        User GetUser(string userName);
        User GetOldUser(string userName);
        /// <summary>
        /// 添加日志
        /// </summary>
        /// <param name="log"></param>
        /// <returns></returns>
        bool AddLog(AppLog log);

        List<User> AllUser(int index,int size ,string key);

        long AllUserCount(int index, int size, string key);

        /// <summary>
        /// 获取配置规则
        /// </summary>
        /// <returns></returns>
        Rule GetRule();

        /// <summary>
        /// 更新配置
        /// </summary>
        /// <param name="rule"></param>
        /// <returns></returns>
        Rule InsertOrUpdate(Rule rule);
        /// <summary>
        /// 系统配置，请在 AppConfig.Keys 增加key调用
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        string? GetConfig(string key);

       

        /// <summary>
        /// 添加通知
        /// </summary>
        /// <returns></returns>
        bool InsertNotice(Notice notice);
        /// <summary>
        /// 更新通知
        /// </summary>
        /// <returns></returns>
        bool UpdateNotice(Notice notice);
        /// <summary>
        /// 获取通知
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        List<Notice> GetNotices(int index, int size, string key);
        /// <summary>
        /// 获取大于date的通知
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        List<Notice> GetNotices(int index, int size, DateOnly date);
        long GetNoticeCount();
        /// <summary>
        /// 添加文件
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        bool Insert(SysFile file);
        /// <summary>
        /// 获取文件信息
        /// </summary>
        /// <param name="md5"></param>
        /// <returns></returns>
        SysFile GetFile(string md5);
    }
}
